package cn.txm;

import cn.txm.quartz.job.PrintJob;
import org.mybatis.spring.annotation.MapperScan;
import org.quartz.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;

import java.awt.*;

@SpringBootApplication
@MapperScan("cn.txm.*.mapper")
@PropertySource("classpath:email.properties")
public class petHomeApp {
    public static void main(String[] args) {
        SpringApplication.run(petHomeApp.class,args);
    }

    /**
     //     * 工作任务
     //     * @return
     //     *//*
    @Bean
    public JobDetail jobDetail(){
        return JobBuilder.newJob(PrintJob.class)
                .withIdentity("9527")       //给这个任务取一个名称
                .storeDurably()            //即使没有Trigger关联时，也不需要删除该JobDetail
                .usingJobData("username","admin")    //传递参数到JobDataMap中
                .build();
    }

    *//**
     * 触发器
     * @return
     *//*
    @Bean
    public Trigger trigger(){
        //每3秒执行一次
        CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule("0/3 * * * * ?");
        return TriggerBuilder.newTrigger()
                .forJob(jobDetail())        //与哪个JobDetail绑定
                .withIdentity("9527-trigger")   //指定触发器名称
                .withSchedule(cronScheduleBuilder)  //添加到哪个调度器容器中
                .build();
    }*/
}
